package com.shenmazong.controller;


import com.shenmazong.entity.TbCodeing;
import com.shenmazong.service.TbCodeingService;
import com.shenmazong.utils.ResultResponse;
import com.shenmazong.vo.ListParamVo;
import org.bouncycastle.cert.ocsp.Req;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;

/**
 * <p>
 * 大纲教学代码  ——>  John
 前端控制器
 * </p>
 *
 * @author 还怕大雨吗
 * @since 2021-09-18
 */
@RestController
@RequestMapping("/tbCodeing")
@CrossOrigin
public class TbCodeingController {

    @Resource
    private TbCodeingService tbCodeingService;

    /***
     * @description 查询全部代码块
     * @params [listParamVo]
     * @return com.shenmazong.utils.ResultResponse
     * @author -还怕大雨吗
     * @date 2021/9/18 13:22
     */
    @PostMapping("/selectCodeIng")
    public ResultResponse selectCodeIng(@RequestBody ListParamVo listParamVo){
        return tbCodeingService.selectCodeIng(listParamVo);
    }

    /***
     * @description 新增代码块
     * @params [listParamVo]
     * @return com.shenmazong.utils.ResultResponse
     * @author -还怕大雨吗
     * @date 2021/9/18 13:23
     */
    @PostMapping("/insertCodeIng")
    public ResultResponse insertCodeIng(@RequestBody TbCodeing tbCodeing){
        return tbCodeingService.insertCodeIng(tbCodeing);
    }

    /***
     * @description 修改代码快
     * @params [listParamVo]
     * @return com.shenmazong.utils.ResultResponse
     * @author -还怕大雨吗
     * @date 2021/9/18 13:23
     */
    @PostMapping("/updateCodeIng")
    public ResultResponse updateCodeIng(@RequestBody TbCodeing tbCodeing){
        return tbCodeingService.updateCodeIng(tbCodeing);
    }

    /***
     * @description 删除代码块
     * @params [listParamVo]
     * @return com.shenmazong.utils.ResultResponse
     * @author -还怕大雨吗
     * @date 2021/9/18 13:24
     */
    @PostMapping("/deleteCodeIng")
    public ResultResponse deleteCodeIng(Long CodeIngID){
        return tbCodeingService.deleteCodeIng(CodeIngID);
    }

    /***
     * @description 上传文件
     * @params [file]
     * @return com.shenmazong.utils.ResultResponse
     * @author -还怕大雨吗
     * @date 2021/9/24 9:51
     */
    @PostMapping("/uploadSescc")
    public ResultResponse uploadSescc(MultipartFile file){
        return tbCodeingService.uploadSescc(file);
    }


    /***
     * @description 下载文件
     * @params [filename]
     * @return com.shenmazong.utils.ResultResponse
     * @author -还怕大雨吗
     * @date 2021/9/24 20:09
     */
    @PostMapping("/downlodSescc")
    public ResultResponse downlodSescc(String filename){
        return tbCodeingService.downlodSescc(filename);
    }



}

